package com.trf.service.role;

import com.trf.dao.BaseDao;
import com.trf.dao.role.RoleDao;
import com.trf.dao.role.RoleDaoIml;
import com.trf.pojo.Role;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * @author 唐荣锋
 * @Date 2022/3/12-星期六-20:22
 */
public class RoleServiceIml implements RoleService{
    //引入Dao层
    private RoleDao roleDao;
    public  RoleServiceIml(){
      roleDao = new RoleDaoIml();

    }

    public List<Role> getRoleList() {
        Connection connection = null;
        List<Role> roleList = null;

        try {
            connection = BaseDao.getConnection();
            roleList = roleDao.getRoleList(connection);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            BaseDao.closeResource(connection,null,null);
        }
        return roleList;
    }
}
